import {isTradeDates} from "./common";
import { ElMessage, ElMessageBox, ElNotification, ElLoading } from 'element-plus'
export function validateStratDate(form){
    //判断是否在交易日
/*    if (!isTradeDates(form.data.effectiveDate)) {
        ElNotification.info({
            title: '请确认期权起始日',
            message: h('i', { style: 'color: teal'}, '期权起始日未在交易日！')
        });
        return false
    }*/
    return true
}
export function validateEndDate(form){
    //判断是否在交易日
    if (!isTradeDates(form.data.terminationDate)) {
        let label = "观察日";
        if (['Vanilla','RangeAccrual'].includes(form.data.productType)){
            label = "到期日";
        }
        ElNotification.info({
            title: '请确认期权'+label,
            message: h('i', { style: 'color: teal'}, '期权'+label+'未在交易日！')
        });
        return
    }
}

export function validateDates(form){
    let res = validateStratDate(form)
    if (res) {
        validateEndDate(form)
    }
}